package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysInformation;
import com.ruoyi.system.domain.SysManagement;
import com.ruoyi.system.domain.SysManagementProcess;
import com.ruoyi.system.service.ISysManagementService;
import com.ruoyi.web.controller.common.CommonController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;


/**
 *招标管理
 * @Author zhaoguanyu
 * @Date 13:59 2022/1/17
 */
@Api(tags = "招标管理")
@RestController
@RequestMapping("/system/bidding")
public class SysManagementController extends BaseController {

    private static final Logger log = LoggerFactory.getLogger(CommonController.class);


    @Autowired
    private ISysManagementService sysManagementService;



    /*
     * 获取项目招标管理进度*/
    @ApiOperation(value = "获取项目招标管理进度")
    @PreAuthorize("@ss.hasPermi('lifecycle:management:list')")
    @GetMapping(value = "/getprogress/{itemNo}")
    public AjaxResult getProgress(@PathVariable("itemNo") String itemNo){
        return AjaxResult.success(sysManagementService.getProgress(itemNo));
    }

    /*
     * 获取提交招标申请*/
    @ApiOperation(value = "获取提交招标申请")
    @PreAuthorize("@ss.hasPermi('lifecycle:management:apply')")
    @GetMapping(value = "/{itemNo}")
    public AjaxResult getCommit(@PathVariable("itemNo") String itemNo){
        return AjaxResult.success(sysManagementService.selectDocumentList(itemNo));
    }

    /*
     * 询价文件确认-会议通知*/
    @ApiOperation(value = "会议通知")
    @PreAuthorize("@ss.hasPermi('lifecycle:management:meeting')")
    @GetMapping(value = "/meeting/{itemNo}")
    public AjaxResult meeting(@PathVariable String itemNo){
        return AjaxResult.success(sysManagementService.selectMeeting(itemNo));
    }

    /*
     * 询价文件确认-询价文件确认*/
    @ApiOperation(value = "询价文件确认")
    @PreAuthorize("@ss.hasPermi('lifecycle:management:askp')")
    @GetMapping(value = "/askprice/{itemNo}")
    public AjaxResult AskPrice(@PathVariable String itemNo){
        return AjaxResult.success(sysManagementService.selectAskPriceFile(itemNo));
    }

    /*
     * 招标-发出招标文件*/
    @ApiOperation(value = "招标-发出招标文件")
    @PreAuthorize("@ss.hasPermi('lifecycle:management:Bidding')")
    @GetMapping(value = "/biddingtype/{itemNo}")
    public AjaxResult biddingFile(@PathVariable String itemNo){
        return AjaxResult.success(sysManagementService.selectBiddingFile(itemNo));
    }

    /*
     * 招标-会议通知*/
    @ApiOperation(value = "招标-会议通知")
    @PreAuthorize("@ss.hasPermi('lifecycle:management:BiddingM')")
    @GetMapping(value = "/biddingmeeting/{itemNo}")
    public AjaxResult biddingmeeting(@PathVariable String itemNo){
        return AjaxResult.success(sysManagementService.selectBiddingMeeting(itemNo));
    }

    /*
     * 招标-提交用印申请审批表/评审报告审批表*/
    @ApiOperation(value = "招标-提交用印申请审批表/评审报告审批表")
    @PreAuthorize("@ss.hasPermi('lifecycle:management:submit')")
    @GetMapping(value = "/biddingassess/{itemNo}")
    public AjaxResult biddingassess(@PathVariable String itemNo){
        return AjaxResult.success(sysManagementService.selectBiddingAssess(itemNo));
    }

    /*
     * 项目经理确认(修改进度)*/
    @ApiOperation(value = "项目经理确认")
    @PreAuthorize("@ss.hasPermi('lifecycle:management:update')")
    @PostMapping("/projectmanager/update")
    public AjaxResult projectmanager(@RequestBody SysManagementProcess sysManagementProcess){
        sysManagementProcess.setCreateBy(getUsername());
        return toAjax(sysManagementService.updateProjectManager(sysManagementProcess));
    }

}
